package com.gree.framework.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gree.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;

/**
 * Created by 180686 on 2021/6/18 14:22
 */

@Data
@NoArgsConstructor
@Table("SAAS_SYS_TENANT")
@ApiModel(description = "租户信息")
public class SaasTenant extends BaseEntity {


    /** 登录账号 */
    @Column(hump = true)
    @ApiModelProperty("登录账号")
    private String sysUid;

    /** ORACLE USERNAME */
    @Column(hump = true)
    @ApiModelProperty("ORACLE USERNAME")
    private String clientId;

    /** 手机号 */
    @Column
    @NotBlank(message = "手机号码不能为空")
    @Pattern(regexp = "^1[0-9]{10}$", message = "手机号不合法")
    @ApiModelProperty("手机号")
    private String mobile;

    /** 密码（暂不编码） */
    @Column
    @NotBlank(message = "密码不能为空")
    @Pattern(regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[\\s\\S]{8,16}$", message = "密码不合法")
    @ApiModelProperty("密码（暂不编码）")
    private String password;

    /** 邮箱 */
    @Column
    @NotBlank(message = "Email不能为空")
    @Email(message = "Email格式不正确")
    @ApiModelProperty("邮箱")
    private String email;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Column
    @ApiModelProperty("创建时间")
    private LocalDateTime create_time;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Column
    @ApiModelProperty("更新时间")
    private LocalDateTime update_time;

    /** 状态 */
    @Column
    @ApiModelProperty("状态")
    private Long status;

    /** 已创建站点数量 */
    @Column(hump = true)
    @ApiModelProperty("已创建站点数量")
    private Long siteNum;

    /** 租户ID */
    @Name
    @ApiModelProperty("租户ID")
    private String tenant_id;

    /** 最大站点数量 */
    @Column(hump = true)
    @ApiModelProperty("最大站点数量")
    private Long maxSiteNum;

    /** 是否租户(1:否2:是) */
    @Column(hump = true)
    @ApiModelProperty("是否租户(1:否2:是)")
    private Long isTenant;

    /** 套餐ID */
    @Column(hump = true)
    @ApiModelProperty("套餐ID")
    private String groupId;

    /** 到期时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Column(hump = true)
    @ApiModelProperty("到期时间")
    private LocalDateTime expireTime;

    /** 主域名 */
    @Column
    @ApiModelProperty("主域名")
    private String domain;

    public void saasSysTenantNoPage()
    {
        super.setBaseEntityNull();
    }

}
